/**
 * 
 */
package tests;

import static org.junit.Assert.*;

import java.io.File;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import FilePanel.Data;
import FilePanel.FilePanelModel;
import PlugIn.PlugIn;
import PlugIn.loader.PlugInFactory;

/**
 * @author wawan
 *	NB : Ce test ne fonctionne qu'avec le jeu de plugins de base
 */
public class PlugInFactoryTest {
	private static final String PATH_TO_CMD = "/home/wawan/Bureau/Plugins/";
	private static final String HOME_PATH = "/";
	
	private Data data;
	private String[] names = {"Size","Rename","Delete"};
	
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUpBeforeClass() throws Exception {
		data = new FilePanelModel(new File(HOME_PATH));
		PlugInFactory.initialiserFactory(PATH_TO_CMD, data);	
	}

	/**
	 * Test method for {@link PlugIn.loader.PlugInFactory#getPlugin(java.lang.String)}.
	 */
	@Test
	public void testGetPlugin() {
		for(String s : names){
			PlugIn p = PlugInFactory.getFactory().getPlugin(s);
			assertTrue(p!=null);
		}	
	}

	/**
	 * Test method for {@link PlugIn.loader.PlugInFactory#getAllPlugIns()}.
	 */
	@Test
	public void testGetAllPlugIns() {
		assertEquals(names.length,PlugInFactory.getFactory().getAllPlugIns().length); 
	}

}
